<!-- pages/login/login.wxml -->
<template>
	<view>
		<view class="top-banner">
			<text>Hi~</text>
			<text>生活商城欢迎您！</text>
			<image class="login-pic" src="../../static/login/login-pic.png"></image>
		</view>
		<view class="content-box">
			<!-- 主体表单 class="main1"-->
			<view class="main1">
				<view class="back-btn yticon icon-zuojiantou-up" @click="navBack"></view>
				<view class="item">
					<image class="login_image" src="../../static/login/userName.png"></image>
					<input v-model="mobile" class="main-input" placeholder="请输入账号" />
				</view>
				<view style="margin-top: 8px"></view>
				<view class="item">
					<image class="login_image" src="../../static/login/password.png"></image>
					<input v-model="password" class="main-input" type="password" placeholder="请输入密码" />
				</view>
			</view>
			<button class="login_info" type="primary" :plain="true" open-type="getUserInfo" @getuserinfo="handleGetUserInfo" style="color: #fff;background-color: #fa436a;border: none;">登录</button>
			<!-- 底部信息 -->
			<view class="footer" style="margin-top: 16px">
				<view style="margin-left: 10%;">
					<navigator url="" open-type="navigate">忘记密码</navigator>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},

		components: {},
		props: {},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {},
		methods: {
			handleGetUserInfo(e) {
				// console.log(e);
				if (this.mobile == '' || this.password == '') {
					uni.showToast({
						icon: 'none',
						title: '手机号或密码不能为空'
					})
					return false;
				} else {
					const {
						userInfo
					} = e.detail;
					uni.setStorageSync("userinfo", userInfo);
					uni.navigateBack({
						delta: 1
					});
				}
			}

		}
	};
</script>
<style>
	@import "./login.css";
</style>
